[[update-deps]]
= Override Spring Boot Dependencies

When using Spring for Apache Kafka in a Spring Boot application, the Apache Kafka dependency versions are determined by Spring Boot's dependency management.
If you wish to use a different version of `kafka-clients` or `kafka-streams`, and use the embedded kafka broker for testing, you need to override their version used by Spring Boot dependency management; set the `kafka.version` property.

NOTE: Default `kafka-clients` dependencies for Spring Boot 3.1.x and 3.2.x are 3.4.1 and 3.6.2 respectively.

Or, to use a different Spring for Apache Kafka version with a supported Spring Boot version, set the `spring-kafka.version` property.

[tabs]
======
Maven::
+
[source, xml, subs="+attributes", role="primary"]
----
<properties>
    <kafka.version>3.5.1</kafka.version>
    <spring-kafka.version>{project-version}</spring-kafka.version>
</properties>

<dependency>
    <groupId>org.springframework.kafka</groupId>
    <artifactId>spring-kafka</artifactId>
</dependency>
<!-- optional - only needed when using kafka-streams -->
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-streams</artifactId>
</dependency>

<dependency>
    <groupId>org.springframework.kafka</groupId>
    <artifactId>spring-kafka-test</artifactId>
    <scope>test</scope>
</dependency>
----

Gradle::
+
[source, groovy, subs="+attributes", role="secondary"]
----
ext['kafka.version'] = '3.5.0'
ext['spring-kafka.version'] = '{project-version}'

dependencies {
    implementation 'org.springframework.kafka:spring-kafka'
    implementation 'org.apache.kafka:kafka-streams' // optional - only needed when using kafka-streams
    testImplementation 'org.springframework.kafka:spring-kafka-test'
}
----
======

The test scope dependencies are only needed if you are using the embedded Kafka broker in tests.